import pandas as pd
import numpy as np


def getrisk(datafile, w, resultfile):
    A = np.array(pd.read_excel(datafile, header=None))
    Z = np.array(w)
    U = np.mat(A)*np.mat(Z.reshape(w.shape[0], 1))
    U = pd.DataFrame(U)
    U.to_excel(resultfile, index=None, header=None)
    return U
